package com.powervision.mvvmdemo.ui.viewmodel

import com.powervision.base.base.BaseViewModel
import com.powervision.http.observer.StateLiveData
import com.powervision.mvvmdemo.ui.model.ArticleListModel
import com.powervision.mvvmdemo.ui.repository.UserArticleRepository

/**
 * @auth: njb
 * @date: 2021/12/28 16:07
 * @desc: 描述
 */
class UserArticleViewModel : BaseViewModel() {
    private val mUserArticleRepository by lazy { UserArticleRepository() }

    val mUserArticleLiveData = StateLiveData<ArticleListModel>()

    fun userArticle(page: Int) {
        launchWithLoading(
            requestBlock = {
                mUserArticleRepository.userArticle(page)
            }, resultCallback = {
                mUserArticleLiveData.value = it
            })
    }
}